// 网络请求模块

// 基础配置
const BASE_URL = 'https://api.example.com'; // 实际开发中需要替换为真实的API地址
const TIMEOUT = 10000;

/**
 * 封装uni.request
 * @param {Object} options - 请求配置
 * @returns {Promise} 请求Promise
 */
function request(options = {}) {
  // 设置默认配置
  const config = {
    url: '',
    method: 'GET',
    data: {},
    header: {
      'Content-Type': 'application/json'
    },
    timeout: TIMEOUT,
    ...options
  };
  
  // 完整URL
  if (!config.url.startsWith('http')) {
    config.url = BASE_URL + config.url;
  }
  // console.log("config",config);
  
  return new Promise((resolve, reject) => {
    uni.request({
      ...config,
      success: (res) => {
        // 处理响应
        if (res.statusCode === 200) {
          resolve(res.data);
        } else {
          reject(new Error(`请求失败: ${res.statusCode}`));
        }
      },
      fail: (err) => {
        // 处理错误
        reject(new Error(`网络错误: ${err.errMsg}`));
      }
    });
  });
}

/**
 * GET请求
 * @param {string} url - 请求地址
 * @param {Object} data - 请求参数
 * @param {Object} options - 其他配置
 * @returns {Promise} 请求Promise
 */
export function get(url, data = {}, options = {}) {
  return request({
    url,
    method: 'GET',
    data,
    ...options
  });
}

/**
 * POST请求
 * @param {string} url - 请求地址
 * @param {Object} data - 请求参数
 * @param {Object} options - 其他配置
 * @returns {Promise} 请求Promise
 */
export function post(url, data = {}, options = {}) {
  return request({
    url,
    method: 'POST',
    data,
    ...options
  });
}

/**
 * PUT请求
 * @param {string} url - 请求地址
 * @param {Object} data - 请求参数
 * @param {Object} options - 其他配置
 * @returns {Promise} 请求Promise
 */
export function put(url, data = {}, options = {}) {
  return request({
    url,
    method: 'PUT',
    data,
    ...options
  });
}

/**
 * DELETE请求
 * @param {string} url - 请求地址
 * @param {Object} data - 请求参数
 * @param {Object} options - 其他配置
 * @returns {Promise} 请求Promise
 */
export function del(url, data = {}, options = {}) {
  return request({
    url,
    method: 'DELETE',
    data,
    ...options
  });
}

/**
 * 获取场地列表
 * @param {Object} params - 查询参数
 * @returns {Promise} 请求Promise
 */
export function getVenueList(params = {}) {
  return get('/venues', params);
}

/**
 * 获取场地详情
 * @param {number} id - 场地ID
 * @returns {Promise} 请求Promise
 */
export function getVenueDetail(id) {
  return get(`/venues/${id}`);
}

/**
 * 获取库卡场地预约设置
 * @param {Object} params - 查询参数 { userId, projectUid, dateTime }
 * @returns {Promise} 请求Promise
 */
export function getZhuoLeVenueSettings(params = {}) {
  return post('https://wxservice-stg48.pospal.cn/wxapi/AppointmentVenue/LoadValidClassRoomApptSettingV2', params, {
    header: {
      'PSPLVISITORAUTO': 'API',
      'APPTYPE': '1',
      'VERSIONINFO': 'NC|2025.02.28',
      'STOREID': '5710920'
    }
  });
}

/**
 * 获取向阳彩鸿湾场地预约设置
 * @param {Object} params - 查询参数 { basicId, merchantId, userId, reserveDate }
 * @returns {Promise} 请求Promise
 */
export function getXiangYangVenueSettings(params = {}) {
  // 设置默认参数
  const defaultParams = {
    basicId: "403170525",
    merchantId: "10166",
    userId: "",
    reserveDate: "2025-08-14"
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  return post('https://api.saas.changxiaoer.cn/consumer/price/front', requestData, {
    header: {
      'content-type': 'application/json',
      'cxe-security-code': 'a45ef582fccf43db9b5c4254c2e33600'
    }
  });
}

/**
 * 获取向阳康帝校区场地预约设置
 * @param {Object} params - 查询参数 { basicId, merchantId, userId, reserveDate }
 * @returns {Promise} 请求Promise
 */
export function getXiangYangKangDiVenueSettings(params = {}) {
  // 设置默认参数
  const defaultParams = {
    basicId: "403144937",
    merchantId: "10166",
    userId: "",
    reserveDate: "2025-08-13"
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  return post('https://api.saas.changxiaoer.cn/consumer/price/front', requestData, {
    header: {
      'content-type': 'application/json',
      'cxe-security-code': 'a45ef582fccf43db9b5c4254c2e33600'
    }
  });
}

/**
 * 获取数据源列表
 * @returns {Promise} 请求Promise
 */
export function getDataSources() {
  return get('/data-sources');
}

/**
 * 更新数据源状态
 * @param {number} id - 数据源ID
 * @param {boolean} enabled - 是否启用
 * @returns {Promise} 请求Promise
 */
export function updateDataSourceStatus(id, enabled) {
  return put(`/data-sources/${id}`, { enabled });
}

/**
 * 获取向阳雅园校区场地预约设置
 * @param {Object} params - 查询参数 { basicId, merchantId, userId, reserveDate }
 * @returns {Promise} 请求Promise
 */
export function getXiangYangYaYuanVenueSettings(params = {}) {
  // 设置默认参数
  const defaultParams = {
    basicId: "403150429",
    merchantId: "10166",
    userId: "",
    reserveDate: "2025-08-13"
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  return post('https://api.saas.changxiaoer.cn/consumer/price/front', requestData, {
    header: {
      'content-type': 'application/json',
      'cxe-security-code': 'a45ef582fccf43db9b5c4254c2e33600'
    }
  });
}

/**
 * 获取向阳33小镇校区场地预约设置
 * @param {Object} params - 查询参数 { basicId, merchantId, userId, reserveDate }
 * @returns {Promise} 请求Promise
 */
export function getXiangYang33VenueSettings(params = {}) {
  // 设置默认参数
  const defaultParams = {
    basicId: "403143353",
    merchantId: "10166",
    userId: "",
    reserveDate: "2025-08-13"
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  return post('https://api.saas.changxiaoer.cn/consumer/price/front', requestData, {
    header: {
      'content-type': 'application/json',
      'cxe-security-code': 'a45ef582fccf43db9b5c4254c2e33600'
    }
  });
}

/**
 * 获取向阳星河城校区场地预约设置
 * @param {Object} params - 查询参数 { basicId, merchantId, userId, reserveDate }
 * @returns {Promise} 请求Promise
 */
export function getXiangYangXingHeChengVenueSettings(params = {}) {
  // 设置默认参数
  const defaultParams = {
    basicId: "403102307",
    merchantId: "10166",
    userId: "",
    reserveDate: "2025-08-13"
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  return post('https://api.saas.changxiaoer.cn/consumer/price/front', requestData, {
    header: {
      'content-type': 'application/json',
      'cxe-security-code': 'a45ef582fccf43db9b5c4254c2e33600'
    }
  });
}

/**
 * 获取爱动金丰网球俱乐部场地预约设置
 * @param {Object} params - 查询参数 { userId, projectUid, dateTime }
 * @returns {Promise} 请求Promise
 */
export function getAiDongJinFengVenueSettings(params = {}) {
  // 设置默认参数
  const defaultParams = {
    userId: 5554966,
    projectUid: "0",
    dateTime: "2025-08-13"
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  return post('https://wxservice-stg48.pospal.cn/wxapi/AppointmentVenue/LoadValidClassRoomApptSettingV2', requestData, {
    header: {
      'PSPLVISITORAUTO': 'API',
      'PSPLVISITORID': 'D1xRCA0+UmAEMQEzCDYIawAzAjRdPwFgUWcGMAdvVzAPaVczWDIAMAVpBjgLZQ08BzACNwlkC2YHOwtvXGFVMQ8+UWY=',
      'APPTYPE': '1',
      'Content-Type': 'application/json',
      'VERSIONINFO': 'NC|2025.02.17',
      'STOREID': '5554966'
    }
  });
}

/**
 * 获取卓乐网球俱乐部场地预约设置
 * @param {Object} params - 查询参数 { dateTime }
 * @returns {Promise} 请求Promise
 */
export function getZhuoLeTennisVenueSettings(params = {}) {
  // 设置默认参数，userId和projectUid固定
  const defaultParams = {
    userId: 5786253,
    projectUid: "1735800065527617183",
    dateTime: "2025-08-19"
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  return post('https://wxservice-stg48.pospal.cn/wxapi/AppointmentVenue/LoadValidClassRoomApptSettingV2', requestData, {
    header: {
      'PSPLVISITORAUTO': 'API',
      'PSPLVISITORID': 'Dl0FXF82VjxWYwQ/DTYNOAcwD29YZQ5uA2IAYQZuX2oEZ1RqDmQDZwBjAjEONA07BzZSNVw/DG0DZ1FiUj0FYw47BTE=',
      'APPTYPE': '1',
      'Content-Type': 'application/json',
      'VERSIONINFO': 'NC|2025.01.01',
      'STOREID': '5786253'
    }
  });
}

/**
 * 获取爱力网球俱乐部场地预约设置
 * @param {Object} params - 查询参数 { dateTime }
 * @returns {Promise} 请求Promise
 */
export function getAiLiVenueSettings(params = {}) {
  // 设置默认参数，userId和projectUid固定
  const defaultParams = {
    userId: 5900824,
    projectUid: "1751942352901414898",
    dateTime: "2025-08-20"
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  return post('https://wxservice-stg48.pospal.cn/wxapi/AppointmentVenue/LoadValidClassRoomApptSettingV2', requestData, {
    header: {
      'PSPLVISITORAUTO': 'API',
      'PSPLVISITORID': 'Dl0FXF82VjxWYwQ/DTYNOAcwD29YZQ5uA2IAYQZuX2oEZ1RqDmQDZwBjAjEONA07BzZSNVw/DG0DZ1FiUj0FYw47BTE=',
      'APPTYPE': '1',
      'Content-Type': 'application/json',
      'VERSIONINFO': 'NC|2025.01.01',
      'STOREID': '5786253'
    }
  });
}

/**
 * 获取3.5+网球（新基）场地基本信息
 * @param {Object} params - 查询参数 { sportHallId, page, limit, whetherOpenUse }
 * @returns {Promise} 请求Promise
 */
export function getDiSaiGroundPage(params = {}) {
  // 设置默认参数
  const defaultParams = {
    sportHallId: "7",
    page: 1,
    limit: -1,
    whetherOpenUse: 1
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  return post('https://xiaonengshou.com.cn/parent-api/predetermineSite/queryGroundPage', requestData, {
    header: {
      'Content-Type': 'application/json'
    }
  });
}

/**
 * 获取3.5+网球（新基）场地预定信息
 * @param {Object} params - 查询参数 { sportHallId, startDate, endDate, page, limit }
 * @returns {Promise} 请求Promise
 */
export function getDiSaiGroundUsePage(params = {}) {
  // 设置默认参数
  const defaultParams = {
    sportHallId: "7",
    startDate: "2025-08-21 00:00:00",
    endDate: "2025-08-22 00:00:00",
    page: 1,
    limit: -1
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  return post('https://xiaonengshou.com.cn/parent-api/predetermineSite/queryGroundUsePage', requestData, {
    header: {
      'Content-Type': 'application/json'
    }
  });
}

/**
 * 获取3.5+网球（金色华庭店）场地基本信息
 * @param {Object} params - 查询参数 { sportHallId, page, limit, whetherOpenUse }
 * @returns {Promise} 请求Promise
 */
export function getJinSeHuaTingGroundPage(params = {}) {
  // 设置默认参数
  const defaultParams = {
    sportHallId: "8",
    page: 1,
    limit: -1,
    whetherOpenUse: 1
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  return post('https://xiaonengshou.com.cn/parent-api/predetermineSite/queryGroundPage', requestData, {
    header: {
      'Content-Type': 'application/json'
    }
  });
}

/**
 * 获取3.5+网球（金色华庭店）场地预定信息
 * @param {Object} params - 查询参数 { sportHallId, startDate, endDate, page, limit }
 * @returns {Promise} 请求Promise
 */
export function getJinSeHuaTingGroundUsePage(params = {}) {
  // 设置默认参数
  const defaultParams = {
    sportHallId: "8",
    startDate: "2025-08-21 00:00:00",
    endDate: "2025-08-22 00:00:00",
    page: 1,
    limit: -1
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  return post('https://xiaonengshou.com.cn/parent-api/predetermineSite/queryGroundUsePage', requestData, {
    header: {
      'Content-Type': 'application/json'
    }
  });
}

/**
 * 获取为傲网球（香树店）场地预定信息
 * @param {Object} params - 查询参数 { companyId, storeId, customerId, motionCusId, rentVenueId, rentAreaId, calendar }
 * @returns {Promise} 请求Promise
 */
export function getWeiAoVenueSettings(params = {}) {
  // 设置默认参数
  const defaultParams = {
    companyId: "4609",
    storeId: "5042",
    customerId: "3604632",
    motionCusId: "",
    rentVenueId: "863",
    rentAreaId: "2156",
    calendar: "2025-09-03"
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  // 手动构建查询字符串
  const queryString = Object.keys(requestData)
    .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(requestData[key])}`)
    .join('&');
  const url = `https://club.lirenos.com//api/vip/rent/period/oneDay/get/batch/new?${queryString}`;
  
  return get(url, {}, {
    header: {
      'Content-Type': 'application/json',
      'token': 'customertoken@625ae119-a2ec-46b8-b4f7-3c1b1e766a11'
    }
  });
}

/**
 * 获取月击网球（丰泰校区）场地预约设置
 * @param {Object} params - 查询参数 { id, date, page, size }
 * @returns {Promise} 请求Promise
 */
export function getYueJiFengTaiVenueSettings(params = {}) {
  // 设置默认参数
  const defaultParams = {
    id: "2982889030025338",
    date: "2025/09/08",
    page: 1,
    size: 10
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  // 手动构建查询字符串
  const queryString = Object.keys(requestData)
    .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(requestData[key])}`)
    .join('&');
  const url = `https://stmember.styd.cn/v1/venues/venues_site_list?${queryString}`;
  
  return get(url, {}, {
    header: {
      'Content-Type': 'application/json',
      'shop-id': '2375138188913821',
      'brand-code': '1ql4d19ZneO',
      'app-id': 'mina',
      'mina-version': 'independent'
    }
  });
}

/**
 * 获取月击网球（电商园校区）场地预约设置
 * @param {Object} params - 查询参数 { id, date, page, size }
 * @returns {Promise} 请求Promise
 */
export function getYueJiDianShangYuanVenueSettings(params = {}) {
  // 设置默认参数
  const defaultParams = {
    id: "2803019859755125",
    date: "2025/09/08",
    page: 1,
    size: 10
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  // 手动构建查询字符串
  const queryString = Object.keys(requestData)
    .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(requestData[key])}`)
    .join('&');
  const url = `https://stmember.styd.cn/v1/venues/venues_site_list?${queryString}`;
  
  return get(url, {}, {
    header: {
      'Content-Type': 'application/json',
      'shop-id': '2375138188913821',
      'brand-code': '1ql4d19ZneO',
      'app-id': 'mina',
      'mina-version': 'independent'
    }
  });
}

/**
 * 获取月击网球（虎门大道校区）场地预约设置
 * @param {Object} params - 查询参数 { id, date, page, size }
 * @returns {Promise} 请求Promise
 */
export function getYueJiHuMenDaDaoVenueSettings(params = {}) {
  // 设置默认参数
  const defaultParams = {
    id: "2803022711881772",
    date: "2025/09/08",
    page: 1,
    size: 10
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  // 手动构建查询字符串
  const queryString = Object.keys(requestData)
    .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(requestData[key])}`)
    .join('&');
  const url = `https://stmember.styd.cn/v1/venues/venues_site_list?${queryString}`;
  
  return get(url, {}, {
    header: {
      'Content-Type': 'application/json',
      'shop-id': '2375138188913821',
      'brand-code': '1ql4d19ZneO',
      'app-id': 'mina',
      'mina-version': 'independent'
    }
  });
}

export default {
  request,
  get,
  post,
  put,
  del,
  getVenueList,
  getVenueDetail,
  getZhuoLeVenueSettings,
  getDataSources,
  updateDataSourceStatus,
  getXiangYangYaYuanVenueSettings,
  getXiangYang33VenueSettings,
  getXiangYangXingHeChengVenueSettings,
  getXiangYangZhenXingChengVenueSettings,
  getTuoDeVenueSettings,
  getAiDongJinFengVenueSettings,
  getZhuoLeTennisVenueSettings,
  getAiLiVenueSettings,
  getDongChengVenueSettings,
  getDongGuanSportsCenterVenueSettings,
  getTaiLuGeVenueSettings,
  getDiSaiGroundPage,
  getDiSaiGroundUsePage,
  getJinSeHuaTingGroundPage,
  getJinSeHuaTingGroundUsePage,
  getWeiAoVenueSettings,
  getFuDiVenueSettings,
  getBuJiVenueSettings,
  getYuanFengVenueSettings,
  getYueJiVenueSettings,
  getYueJiFengTaiVenueSettings,
  getYueJiDianShangYuanVenueSettings,
  getYueJiHuMenDaDaoVenueSettings
};

/**
 * 获取向阳振兴城校区场地预约设置
 * @param {Object} params - 查询参数 { basicId, merchantId, userId, reserveDate }
 * @returns {Promise} 请求Promise
 */
export function getXiangYangZhenXingChengVenueSettings(params = {}) {
  // 设置默认参数
  const defaultParams = {
    basicId: "403160622",
    merchantId: "10166",
    userId: "",
    reserveDate: "2025-08-13"
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  return post('https://api.saas.changxiaoer.cn/consumer/price/front', requestData, {
    header: {
      'content-type': 'application/json',
      'cxe-security-code': 'a45ef582fccf43db9b5c4254c2e33600'
    }
  });
}

/**
 * 获取拓德网球俱乐部场地预约设置
 * @param {Object} params - 查询参数 { basicId, merchantId, userId, reserveDate }
 * @returns {Promise} 请求Promise
 */
export function getTuoDeVenueSettings(params = {}) {
  // 设置默认参数
  const defaultParams = {
    basicId: "2112235080",
    merchantId: "10293",
    userId: "",
    reserveDate: "2025-08-13"
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  return post('https://api.saas.changxiaoer.cn/consumer/price/front', requestData, {
    header: {
      'content-type': 'application/json',
      'cxe-security-code': '499902fbd32341cb83ea8964814b99ee'
    }
  });
}

/**
 * 获取东城体育公园场地预约设置
 * @param {Object} params - 查询参数 { gym_id, type, filter_front_reserve, date }
 * @returns {Promise} 请求Promise
 */
export function getDongChengVenueSettings(params = {}) {
  // 设置默认参数
  const defaultParams = {
    gym_id: 1,
    type: 'site',
    filter_front_reserve: 0,
    date: '2025-8-20'
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  // 手动构建查询字符串
  const queryString = Object.keys(requestData)
    .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(requestData[key])}`)
    .join('&');
  const url = `https://api.dctygy.cn/api/wechat/gym/reserve?${queryString}`;
  
  return get(url, {}, {
    header: {
      'Authorization': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoie1widXNlcl9pZFwiOjE1MjR9IiwiZXhwIjoxNzU2MTkzODM2fQ.HOLeFkmFMSNe1bC6_OZFYVtSW-oWSYWXypOAVK50wwg',
      'Content-Type': 'application/json'
    }
  });
}



/**
 * 获取东莞市体育中心场地预约设置
 * @param {Object} params - 查询参数 { gym_id, type, date }
 * @returns {Promise} 请求Promise
 */
export function getDongGuanSportsCenterVenueSettings(params = {}) {
  // 设置默认参数
  const defaultParams = {
    gym_id: 5,
    type: 'site',
    date: '2025-8-19'
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  // 手动构建查询字符串
  const queryString = Object.keys(requestData)
    .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(requestData[key])}`)
    .join('&');
  const url = `https://api.dgstyzx.com/api/wechat/gym/reserve?${queryString}`;
  
  return get(url, {}, {
    header: {
      'Authorization': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoie1widXNlcl9pZFwiOjEyMjE5fSIsImV4cCI6MTc1NTY4MTIyMH0.Q7cs173QOt3A6AJAhDhoxIUk-3PcXn-Q0oYUdKlRJwM',
      'Content-Type': 'application/json'
    }
  });
}

/**
 * 获取松山湖太鲁阁公园场地预约设置
 * @param {Object} params - 查询参数 { gym_id, type, date }
 * @returns {Promise} 请求Promise
 */
export function getTaiLuGeVenueSettings(params = {}) {
  // 设置默认参数
  const defaultParams = {
    gym_id: 42,
    type: 'site',
    date: '2025-9-2'
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  // 手动构建查询字符串
  const queryString = Object.keys(requestData)
    .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(requestData[key])}`)
    .join('&');
  const url = `https://api.sshtyt.cn/api/wechat/gym/reserve?${queryString}`;
  
  return get(url, {}, {
    header: {
      'Authorization': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoie1widXNlcl9pZFwiOjIwNDI4fSIsImV4cCI6MTc1NzM4NDI3OX0.qoJI6Cxnngc-jKAIhOn_HddrHtfwBu_HWmDAYGCo5e8',
      'Content-Type': 'application/json',
      'xweb_xhr': '1'
    }
  });
}

/**
 * 获取3.5+网球（福地）场地预约设置
 * @param {Object} params - 查询参数 { date, deskTypeId, shopId, shopName, token }
 * @returns {Promise} 请求Promise
 */
export function getFuDiVenueSettings(params = {}) {
  // 设置默认参数
  const defaultParams = {
    date: "2025-09-02",
    deskTypeId: "463560331927552",
    shopId: "455834640958464",
    shopName: "3.5+网球运动馆",
    token: ""
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  return post('https://room.yunvip123.cn/prod-api/room/smallProgram/bookingBoard', requestData, {
    header: {
      'Content-Type': 'application/json'
    }
  });
}

/**
 * 获取埗击网球场地预约设置
 * @param {Object} params - 查询参数 { userId, projectUid, dateTime }
 * @returns {Promise} 请求Promise
 */
export function getBuJiVenueSettings(params = {}) {
  return post('https://wxservice-stg48.pospal.cn/wxapi/AppointmentVenue/LoadValidClassRoomApptSettingV2', params, {
    header: {
      'PSPLVISITORAUTO': 'API',
      'APPTYPE': '1',
      'VERSIONINFO': 'NC|2025.02.28',
      'STOREID': '5710920'
    }
  });
}

/**
 * 获取源峰网球场地预约设置
 * @param {Object} params - 查询参数 { userId, projectUid, dateTime }
 * @returns {Promise} 请求Promise
 */
export function getYuanFengVenueSettings(params = {}) {
  return post('https://wxservice-stg48.pospal.cn/wxapi/AppointmentVenue/LoadValidClassRoomApptSettingV2', params, {
    header: {
      'PSPLVISITORAUTO': 'API',
      'APPTYPE': '1',
      'VERSIONINFO': 'NC|2025.02.28',
      'STOREID': '5871935'
    }
  });
}

/**
 * 获取罗杰网球场地基本信息
 * @param {Object} params - 查询参数 { sportHallId }
 * @returns {Promise} 请求Promise
 */
export function getLuoJieGroundPage(params = {}) {
  // 设置默认参数
  const defaultParams = {
    sportHallId: "17"
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  return post('https://xiaonengshou.com.cn/parent-api/predetermineSite/queryGroundPage', requestData, {
    header: {
      'Content-Type': 'application/json'
    }
  });
}

/**
 * 获取罗杰网球场地使用信息
 * @param {Object} params - 查询参数 { sportHallId, startDate, endDate }
 * @returns {Promise} 请求Promise
 */
export function getLuoJieGroundUsePage(params = {}) {
  // 设置默认参数
  const defaultParams = {
    sportHallId: "17",
    startDate: "",
    endDate: ""
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  return post('https://xiaonengshou.com.cn/parent-api/predetermineSite/queryGroundUsePage', requestData, {
    header: {
      'Content-Type': 'application/json'
    }
  });
}

/**
 * 获取月击网球（城市之光校区）场地预约设置
 * @param {Object} params - 查询参数 { id, date, page, size }
 * @returns {Promise} 请求Promise
 */
export function getYueJiVenueSettings(params = {}) {
  // 设置默认参数
  const defaultParams = {
    id: "2883247634186321",
    date: "2025/09/08",
    page: 1,
    size: 10
  };
  
  // 合并参数
  const requestData = { ...defaultParams, ...params };
  
  // 手动构建查询字符串
  const queryString = Object.keys(requestData)
    .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(requestData[key])}`)
    .join('&');
  const url = `https://stmember.styd.cn/v1/venues/venues_site_list?${queryString}`;
  
  return get(url, {}, {
    header: {
      'Content-Type': 'application/json',
      'shop-id': '2375138188913821',
      'brand-code': '1ql4d19ZneO',
      'app-id': 'mina',
      'mina-version': 'independent'
    }
  });
}
